package com.fanbuchi.app.ins.ui;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Toast;

import com.fanbuchi.app.ins.R;
import com.squareup.timessquare.CalendarPickerView;

import java.util.Calendar;
import java.util.Date;

public class CalendarActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calendar);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        Calendar nextYear = Calendar.getInstance();
       // nextYear.add(Calendar.YEAR, 1);
        nextYear.add(Calendar.MONTH,1);
        CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view);
        java.util.Date today = new  java.util.Date();
        calendar.init(today, nextYear.getTime())
                .withSelectedDate(today);

        calendar.setOnDateSelectedListener(new CalendarPickerView.OnDateSelectedListener() {
            @Override
            public void onDateSelected(Date date) {
                Toast.makeText(CalendarActivity.this, "onDateSelected="+date.toString(), Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onDateUnselected(Date date) {
                Toast.makeText(CalendarActivity.this, "onDateUnselected="+date.toString(), Toast.LENGTH_SHORT).show();
            }
        });


    }

}
